Skip to main content
ICT
Lesson A12 - Iterations
 
Main Previous Next
Title Page >  
Summary >  
Lesson A1 >  
Lesson A2 >  
Lesson A3 >  
Lesson A4 >  
Lesson A5 >  
Lesson A6 >  
Lesson A7 >  
Lesson A8 >  
Lesson A9 >  
Lesson A10 >  
Lesson A11 >  
Lesson A12 >  
Lesson A13 >  
Lesson A14 >  
Lesson A15 >  
Lesson A16 >  
Lesson A17 >  
Lesson A18 >  
Lesson A19 >  
Lesson A20 >  
Lesson A21 >  
Lesson A22 >  
Lesson AB23 >  
Lesson AB24 >  
Lesson AB25 >  
Lesson AB26 >  
Lesson AB27 >  
Lesson AB28 >  
Lesson AB29 >  
Lesson AB30 >  
Lesson AB31 >  
Lesson AB32 >  
Lesson AB33 >  
Vocabulary >  
 

LAB ASSIGNMENT A12.5 page 16 of 18

Payments

Background:

Borrowing money for expensive items has become a way of life for most Americans. To illustrate the high cost of borrowing and how such loans work, you will be writing a class to calculate the following monthly analysis of a loan.

Month Principal Loan Amt. Interest
(at 1%/month)
Payment New Balance
         
1 10000.00 100.00 300.00 9800.00
2 9800.00 98.00 300.00 9598.00
3 9598.00 95.98 300.00 9393.98
4 9393.98 93.94 300.00 9187.92
         
and many months later ...
         
39 809.46 8.09 300.00 517.55
40 517.55 5.18 300.00 222.73
         
Total:   2222.73    

The loan analysis above started with the following information:

Principal (amount borrowed) = 10000.00
Annual Interest Rate = 12.0 %
Monthly Payment = 300.00

The monthly interest rate is found by dividing the annual rate among 12 months. For the above example the monthly rate is 1.0 %. The last three values of each line are calculated as follows:

Interest = Principal * Monthly Interest Rate
Payment = amount set at beginning of problem
New Balance = Principal + Interest - Payment

The new balance becomes the starting principal amount for the next month. As you can see, progress toward decreasing the principal is slow at the beginning of the loan.

Assignment:

Write a class to represent a loan as described above using the five-column format. Your class must accomplish the following:

  1. Data input: The class should ask for the appropriate starting information.

  2. Printing of analysis: The class must print the month-by-month analysis until the remaining principal is less than the monthly payment. At the bottom of the analysis you must print the total interest paid to the lending institution.

Instructions:

  1. Here are some sample data sets:

    Principal = 12000
    Annual Interest Rate = 8.80
    Monthly Payment = 500.00

    Principal = 10000
    Annual Interest Rate = 12.0
    Monthly Payment = 300.00

Extending the Lab:

  1. To vary the assignment, we now want to save some money and earn interest. Suppose we wish to study the effect of time and compounding interest on investments. Add an option to ask the user for:

    Starting Principal to invest
    Annual Rate of Return (5%, 10%, etc)
    Monthly Addition to the Principal
    Number of Months to Iterate

  2. The printout will be similar except the column called “payment” will be changed to investment. You should still calculate and print out the total interest and final balance.

  3. This lab exercise should encourage you to start investing early in life.

 

Main Previous Next
Contact
 © ICT 2006, All Rights Reserved.